import request from "./useRequests";
import { userinfo } from '@/stores/counter'
import { ElMessage } from 'element-plus'

export default function getDiscussions() {
    const user = userinfo()
    async function getDiscussionList(page: number = 1, limit: number = 9999, type: number = 2) {
        try {
            const res = await request({
                method: "get",
                url: `/news/getDiscussions`,
                params: {
                    page,
                    limit,
                    type
                }
            })
            return res.data.data.list

        } catch (err: any) {
            //alert(err)
        }
    }

    return {
        getDiscussionList
    }
}